package com.hsnn.medstgmini.pro.plan.service.impl;

import java.sql.Timestamp;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hsnn.medstgmini.pro.plan.dao.BasePriceadjplandetailDao;
import com.hsnn.medstgmini.pro.plan.service.BasePriceadjplandetailManager;
import com.hsnn.medstgmini.util.DateUtil;
import com.hsnn.medstgmini.util.Pagination;

@Service
public class BasePriceadjplandetailManagerImpl implements BasePriceadjplandetailManager {

	@Autowired
	private BasePriceadjplandetailDao basePriceadjplandetailDao;
	
	/**
	 * 
	 * @category 获取调价计划明细列表
	 * @auth wangbing
	 * @return Pagination
	 * @date 2015年6月23日
	 */
	@SuppressWarnings("unchecked")
	@Override
	public Pagination getPriceDurgList(Pagination page) {
		List<Map<String,Object>> list = (List<Map<String, Object>>) basePriceadjplandetailDao.getPriceDurgList(page).getRows(); 
		for(Map<String,Object> data : list){
			data.put("addDatetime", DateUtil.dateTime((Timestamp)data.get("addDatetime")));
		}
		page.setRows(list);
		return page;
	}
	
	/**
	 * 
	 * @category 获取历史调价信息
	 * @auth wangbing
	 * @return Pagination
	 * @date 2015年6月23日
	 */
	@SuppressWarnings("unchecked")
	@Override
	public Pagination getHistoryDataList(Pagination page) {
		List<Map<String,Object>> list = (List<Map<String, Object>>) basePriceadjplandetailDao.getHistoryDataList(page).getRows(); 
		for(Map<String,Object> data : list){
			data.put("executeDatetime", DateUtil.dateTime((Timestamp)data.get("executeDatetime")));
			data.put("addDatetime", DateUtil.dateTime((Timestamp)data.get("addDatetime")));
		}
		page.setRows(list);
		return page;
	}
 
}
